package com.matt.domain.course;

import com.matt.commons.model.Domain;
import com.matt.foundation.vo.course.VendorCoursePrepareDetailVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2018/11/12
 * *******************************
 */
@Entity
@Table(name = "prepare_course")
@Data
@EqualsAndHashCode(callSuper = true)
public class PrepareCourse extends Domain{

    @Column(columnDefinition = "varchar(32) COMMENT '安排课程id'")
    private String coursePlanClassesId;

    @Column(columnDefinition = "varchar(32) COMMENT '课程id'")
    private String courseId;

    @Column(columnDefinition = "varchar(50) COMMENT '课程名称'")
    private String courseName;

    @Column(columnDefinition = "varchar(255) COMMENT '课程类型名称'")
    private String typeName;

    @Column(columnDefinition = " int DEFAULT 1 COMMENT ' 类型：1，SAT早教课程，2，园区自建，3，公共课程 ' ")
    private Integer courseType;

    @Column(columnDefinition = "varchar(32) COMMENT '最后修改人'")
    private String lastModifiedId;

    @Column(columnDefinition = "varchar(32) COMMENT '最后修改人名称'")
    private String lastModifiedName;

    @Column(columnDefinition = " datetime DEFAULT NOW() COMMENT '最后修改时间' ")
    private Date lastModified = new Date();

    @Column(columnDefinition = "int default 1  COMMENT '备课模版类型：1：主题课'")
    private Integer templateType;

    @Column(columnDefinition = "varchar(32) COMMENT '备课对象id'")
    private String prepareTemplateId;

    @Column(columnDefinition = "text COMMENT '附件列表JSON [{ \"name\":\"\", \"type\":\"\",url:\"\"}]'")
    private String attachments;
    @Column(columnDefinition = "text COMMENT '教具列表 [{ \"name\":\"\", \"count\":\"\",\"unit\":\"\",img:\"\"}]'")
    private String tools;
    @Column(columnDefinition = "text COMMENT '内容'")
    private String content;
    @Column(columnDefinition = "varchar(32) COMMENT '课程包id' ")
    private String coursePackageId;
    @Column(columnDefinition = "varchar(256) COMMENT '分类名称'")
    private String packageName;
    @Column(columnDefinition = "varchar(500) COMMENT '视频地址'")
    private String videourl;



    public static PrepareCourse of(VendorCoursePrepareDetailVO prepareDetail, String coursePlanClassesId, String courseId, String courseName, String typeName, Integer courseType, String lastModifiedId, String lastModifiedName){
        PrepareCourse prepareCourse = new PrepareCourse();
        prepareCourse.setCoursePlanClassesId(coursePlanClassesId);
        prepareCourse.setCourseId(courseId);
        prepareCourse.setCourseName(courseName);
        prepareCourse.setTypeName(typeName);
        prepareCourse.setCourseType(courseType);
        prepareCourse.setLastModifiedId(lastModifiedId);
        prepareCourse.setLastModifiedName(lastModifiedName);
        prepareCourse.setAttachments(prepareDetail.getAttachments());
        prepareCourse.setContent(prepareDetail.getContent());
        prepareCourse.setTools(prepareDetail.getTools());
        prepareCourse.setVideourl(prepareDetail.getVideourl());
        return prepareCourse;
    }
}
